#include "bricks.h"
#include <fstream>

int main() {
    ifstream inputStream;
    inputStream.open("/Users/lacoste/Documents/input.txt", ios::in);
    string str;
    inputStream >> str;
    Bricks my_bricks(str);
    string brick;
    while (inputStream >> brick) {
        my_bricks.pushToBricks(brick);
    }

    if (my_bricks.solve()) {
        my_bricks.printResult();
    } else {
        cout << "NO\n";
    }
}